package com.zzyl.web.core;

import com.zzyl.nursing.service.WechatService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
public class WechatServiceImplTest {

    @Autowired
    private WechatService wechatService;
    private String code = "0a1Zih1w3uERN53O0y3w3zuga51Zih11";
    private String phoneCode = "e8ca4c74df62e48853e3998e3004b2ec5ebf2e8cb85fa93b2223c7d19cab3961";

    @Test
    public void testGetOpenid() {
        String openid = wechatService.getOpenid(code);
        System.out.println("openid="+openid);//o3CsK6_C6f4WP9b0AxXNJOkc6q9Q
    }
    @Test
    public void testGetAccessToken() {
        String accessToken = wechatService.getAccessToken();
        System.out.println( "accessToken="+accessToken);
    }

    @Test
    public void testGetPhone() {
        String phone = wechatService.getPhone(phoneCode);
        System.out.println( "phone="+phone);
    }
}